#include "MysqlManager.h"

MysqlManager::~MysqlManager()
{
    std::cout << "destruct MysqlManager......" << std::endl;
}

int MysqlManager::regUser(const std::string& name, const std::string& email, const std::string& pwd, const std::string& icon)
{
    return m_dao.registerUser(name, email, pwd, icon);
}

bool MysqlManager::checkEmail(const std::string& name, const std::string& email)
{
    return m_dao.checkEmail(name, email);
}

bool MysqlManager::updatePwd(const std::string& name, const std::string& pwd)
{
    return m_dao.updatePwd(name, pwd);
}

bool MysqlManager::checkPwd(const std::string& name, const std::string& pwd, UserInfo& userInfo)
{
    return m_dao.checkPwd(name, pwd, userInfo);
}

bool MysqlManager::addFriendApply(const int& from, const int& to)
{
    return m_dao.addFriendApply(from, to);
}

bool MysqlManager::getApplyList(int touid, std::vector<std::shared_ptr<ApplyInfo>>& applyList, int begin, int limit)
{
    return m_dao.getApplyList(touid, applyList, begin, limit);
}

bool MysqlManager::getFriendList(int self_id, std::vector<std::shared_ptr<UserInfo>>& user_info)
{
    return m_dao.getFriendList(self_id, user_info);;
}

bool MysqlManager::authFriendApply(const int& from, const int& to)
{
    return m_dao.authFriendApply(from, to);
}

bool MysqlManager::addFriend(const int& from, const int& to, std::string back_name)
{
    return m_dao.addFriend(from, to, back_name);
}

bool MysqlManager::authFriendApplyAndAddFriend(const int& from, const int& to, std::string back_name)
{
    return m_dao.authFriendApplyAndAddFriend(from, to, back_name);
}

std::shared_ptr<UserInfo> MysqlManager::getUserInfo(int uid)
{
    return m_dao.getUserInfo(uid);
}

std::shared_ptr<UserInfo> MysqlManager::getUserInfo(std::string name)
{
    return m_dao.getUserInfo(name);
}
